package com.springcachetest;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.core.env.Environment;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.net.InetAddress;
import java.net.UnknownHostException;

@EnableCaching
@EnableAspectJAutoProxy
@EnableSwagger2
@SpringBootApplication
@Slf4j
public class SpringcachetestApplication {

	public static void main(String[] args) throws UnknownHostException {
		Environment env = SpringApplication.run(SpringcachetestApplication.class, args).getEnvironment();
		String port = env.getProperty("server.port", "8080");
		log.info(
				"Access URLs:\n----------------------------------------------------------\n\t"
						+ "Swagger-UI: http://127.0.0.1:{}/swagger-ui.html\n\t"
						+ "Local: \t\thttp://127.0.0.1:{}\n\t"
						+ "External: \thttp://{}:{}\n----------------------------------------------------------",
				port, InetAddress.getLocalHost().getHostAddress(), port
		);
	}

}
